﻿/*********************************************************************************
 * Copyright(c)  	2012 @kaleyroy
 * 创建日期：		2012-01-05 21:38:30
 * 文 件 名：		LevelData.cs 
 * CLR 版本: 		4.0.30319.239 
 * 创 建 者：		@kaleyroy 
 * 电子邮箱:		kaleyroy@gmail.com
**********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using USS.Core;
using USS.Domain;

/// <summary>
/// 
/// 修改记录:
///	
/// </summary>
namespace USS.Service.DataObject
{
    /// <summary>
    /// 级别数据对象
    /// </summary>
    public class LevelData : IDataObject<Level>
    {
        /// <summary>
        /// 级别编号
        /// </summary>
        public int LevelID { get; set; }

        /// <summary>
        /// 级别名称
        /// </summary>
        public string LevelName { get; set; }

        /// <summary>
        /// 单数
        /// </summary>
        public int BillCount { get; set; }

        /// <summary>
        /// 级别颜色
        /// </summary>
        public string LevelColor { get; set; }

        /// <summary>
        /// 可用状态
        /// </summary>
        public bool IsEnabled { get; set; }


        public void FromEntity(Level entity)
        {
            this.LevelID = entity.LevelID;
            this.LevelName = entity.LevelName;
            this.BillCount = entity.BillCount;
            this.LevelColor = entity.LevelColor;
            this.IsEnabled = entity.IsEnabled == 1 ? true : false;
        }

        public Level ToEntity()
        {
            return new Level()
            {
                LevelID = this.LevelID,
                LevelName = this.LevelName,
                BillCount = this.BillCount,
                LevelColor = this.LevelColor,
                IsEnabled = this.IsEnabled ? 1 : 0
            };
        }
    }
}
